<template>
	<view class="container">
		<view class="navigation">
			<uni-icons type="bars" size="30" color="#ffffff"
				@click="$tab.navigateTo('/pages/userInfo/userInfo')"></uni-icons>
			<view class="navigation-center">
				<svg t="1727956152858" class="icon" viewBox="0 0 1024 1024" version="1.1"
					xmlns="http://www.w3.org/2000/svg" p-id="1901" width="28" height="28">
					<path
						d="M1008.794182 514.180666c0 51.085492-41.412179 92.498694-92.497671 92.498694L112.022864 606.679359c-51.083445 0-92.497671-41.413202-92.497671-92.498694l0 0c0-51.083445 41.413202-92.497671 92.497671-92.497671l804.27467 0C967.382003 421.682995 1008.794182 463.096197 1008.794182 514.180666L1008.794182 514.180666z"
						fill="#00A651" p-id="1902"></path>
					<path
						d="M514.159688 19.547195c51.085492 0 92.498694 41.412179 92.498694 92.496647l0 804.273646c0 51.085492-41.413202 92.498694-92.498694 92.498694l0 0c-51.084469 0-92.497671-41.413202-92.497671-92.498694L421.662017 112.043842C421.66304 60.959374 463.076242 19.547195 514.159688 19.547195L514.159688 19.547195z"
						fill="#00A651" p-id="1903"></path>
				</svg>
				<text style="margin-left: 30rpx;font-size: 32rpx;">医邻</text>
			</view>
			<uni-icons type="notification-filled" size="30" color="#ffffff"></uni-icons>
		</view>
		<view class="main-container">
			<view class="search-container">
				<input class="search-input" type="text" placeholder="查询记录.." />
				<button class="search-button">搜索</button>
			</view>
			<view class="sub-container">
				<u-tabs :list="tabList" @click="tabClick" lineWidth="30" lineColor="#f56c6c" :activeStyle="{
			    color: '#303133',
			    fontWeight: 'bold',
			    transform: 'scale(1.05)'
			}" :inactiveStyle="{
			    color: '#606266',
			    transform: 'scale(1)'
			}" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"></u-tabs>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabList: [],
			};
		},
		onShow() {
			if(this.$store.state.user.userInfo.role === '患者') {
				tabClick({name: '待收货'})
			} else if(this.$store.state.user.userInfo.role === '医生') {
				tabClick({name: '待派送'})
			}
		},
		onLoad() {
			if (this.$store.state.user.userInfo.role === '患者') {
				this.tabList = [{
						name: '待收货'
					},
					{
						name: '已购药品'
					},
				]
			} else if (this.$store.state.user.userInfo.role === '医生') {
				this.tabList = [{
						name: '待派送'
					},
					{
						name: '历史处理'
					}
				]
			} else {
				toast('用户角色不存在')
			}
		},
		methods: {
			tabClick(e) {
				console.log(e)
			}
		}
	}
</script>

<style lang="scss">
	.container {
		height: 100%;
		display: flex;
		flex-direction: column;
		background-color: #ffffff;

		.navigation {
			height: 100rpx;
			padding: 0 30rpx;
			background-color: #84C99A;
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: #ffffff;

			.navigation-center {
				display: flex;
				align-items: center;
			}
		}

		.main-container {
			flex: 1;
			padding: 20rpx;
			// 定义颜色变量
			$green-border-color: #4CAF50;
			$darker-green-border-color: #388E3C;
			$darkest-green-border-color: #1B5E20;
			$input-background-color: #f9f9f9;
			$text-color: #333;
			$button-text-color: white;
			$input-font-size: 16px;
			$shadow-color: rgba(0, 0, 0, 0.1);

			.search-container {
				display: flex;
				justify-content: center;
				align-items: center;
				margin: 20rpx; // 边距

				.search-input {
					width: 80%; // 调整宽度以适应屏幕大小
					height: 40px; // 输入框高度
					padding: 0 15px; // 内边距
					border: 2px solid $green-border-color; // 绿色边框
					border-radius: 25px 0 0 25px; // 左侧圆角
					background-color: $input-background-color; // 背景颜色
					color: $text-color; // 文字颜色
					font-size: $input-font-size; // 字体大小
					transition: all 0.3s ease; // 平滑过渡效果

					&:hover {
						border-color: $darker-green-border-color; // 更深的绿色
					}

					&:focus {
						border-color: $darkest-green-border-color; // 更深的绿色
						outline: none; // 移除默认轮廓
						box-shadow: 0 0 10px $shadow-color; // 添加阴影
					}
				}

				.search-button {
					width: 20%; // 调整宽度以适应屏幕大小
					height: 40px; // 按钮高度
					padding: 0 15px; // 内边距
					border: 2px solid $green-border-color; // 绿色边框
					border-radius: 0 25px 25px 0; // 右侧圆角
					background-color: $green-border-color; // 绿色背景
					color: $button-text-color; // 文字颜色
					font-size: $input-font-size; // 字体大小
					cursor: pointer; // 鼠标指针样式
					transition: all 0.3s ease; // 平滑过渡效果

					&:hover {
						background-color: $darker-green-border-color; // 更深的绿色
					}

					&:active {
						background-color: $darkest-green-border-color; // 更深的绿色
					}
				}
			}

			.sub-container {
				padding: 0 30rpx;
				margin-top: 30rpx;
			}
		}
	}
</style>